/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session05;

import java.util.Iterator;
import java.util.LinkedHashSet;
import session04.Student;

/**
 *
 * @author macbookpro
 */
public class CollectionGeneric {
    public static void main(String[] args) {
        LinkedHashSet<Student> lhs = new LinkedHashSet<Student>();
        
        lhs.add(new Student("R00004", "aaaa"));
        lhs.add(new Student("R00001", "bbbb"));
        lhs.add(new Student("R00005", "xxxx"));
        lhs.add(new Student("R00002", "cccc"));
        //lhs.add("abcdef");
        
//        for(Student s : lhs){
//            System.out.println(s.getRollNo());
//        }
        
        //Nen su dung voi Iterator
        Iterator i = lhs.iterator();
        while (i.hasNext()) {
            System.out.println(((Student)i.next()).getRollNo());
        }
    }
}
